Skip to content
This repository was archived by the owner on Jul 15, 2024. It is now read-only.

feat: refresh rewards automation#34

Open
brotherlymite wants to merge 15 commits into
mainfrom
feat/refresh-automation
Open

feat: refresh rewards automation#34
brotherlymite wants to merge 15 commits into
mainfrom
feat/refresh-automation

Conversation

@brotherlymite
Copy link
Copy Markdown

@brotherlymite brotherlymite commented Apr 4, 2023

RefreshRewardsRobot:

Chainlink automation compatible robot to automate refreshing rewards for static-a-token whenever a new LM reward has been added to an aToken.

When a reward is added after static-a-token creation, it needs to be registered manually on the token via the permissionless refreshRewardTokens() method. As this process is not currently automated users might be missing out on rewards until the method is called, so now we aim to automate this process.

Gas Capped Refresh Rewards Robot:

Similar to the refresh reward robot with an additional functionality of executing actions only when the current network gas price is under the configured gas price. The robot uses chainlink fast-gas feed to fetch the current network gas prices. Since chainlink fast-gas feed is currently only available on mainnet, the gas-capped robots will be used only on ethereum.

Gelato Gas Capped Refresh Rewards Robot:

Extending the gas capped refresh reward robots which is used to limit the execution on actions based on network gas prices, Gelato Gas Capped Robots is intended to be used via Gelato functions. The major difference from Gas Capped Refresh Rewards Robot which is used on chainlink automation is that on Gelato Gas Capped Robots we use tx.gasprice to fetch the current network gas price instead of the chainlink fast gas feed as Gelato natively supports tx.gasprice in their checker function.

@brotherlymite brotherlymite marked this pull request as draft April 4, 2023 16:50
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 4, 2023

Foundry report

forge 0.2.0 (7bfe5bf 2023-04-05T00:04:39.653167838Z)
Build log
installing solc version "0.8.10"
Successfully installed solc 0.8.10
Compiling 100 files with 0.8.10
Solc 0.8.10 finished in 9.66s
Compiler run successful (with warnings)
�[33mwarning[2519]: �[0m�[33mWarning: This declaration shadows an existing declaration.
  --> lib/aave-v3-core/contracts/protocol/tokenization/base/IncentivizedERC20.sol:74:5:
   |
74 |     string memory name,
   |     ^^^^^^^^^^^^^^^^^^
Note: The shadowed declaration is here:
  --> lib/aave-v3-core/contracts/protocol/tokenization/base/IncentivizedERC20.sol:86:3:
   |
86 |   function name() public view override returns (string memory) {
   |   ^ (Relevant source part starts here and spans across multiple lines).

�[0m

�[33mwarning[8760]: �[0m�[33mWarning: This declaration has the same name as another declaration.
  --> lib/aave-v3-core/contracts/protocol/tokenization/base/IncentivizedERC20.sol:75:5:
   |
75 |     string memory symbol,
   |     ^^^^^^^^^^^^^^^^^^^^
Note: The other declaration is here:
  --> lib/aave-v3-core/contracts/protocol/tokenization/base/IncentivizedERC20.sol:91:3:
   |
91 |   function symbol() external view override returns (string memory) {
   |   ^ (Relevant source part starts here and spans across multiple lines).

�[0m

�[33mwarning[8760]: �[0m�[33mWarning: This declaration has the same name as another declaration.
  --> lib/aave-v3-core/contracts/protocol/tokenization/base/IncentivizedERC20.sol:76:5:
   |
76 |     uint8 decimals
   |     ^^^^^^^^^^^^^^
Note: The other declaration is here:
  --> lib/aave-v3-core/contracts/protocol/tokenization/base/IncentivizedERC20.sol:96:3:
   |
96 |   function decimals() external view override returns (uint8) {
   |   ^ (Relevant source part starts here and spans across multiple lines).

�[0m

�[33mwarning[5667]: �[0m�[33mWarning: Unused function parameter. Remove or comment out the variable name to silence this warning.
   --> src/StaticATokenLM.sol:538:59:
    |
538 |   function _beforeTokenTransfer(address from, address to, uint256 amount) internal override {
    |                                                           ^^^^^^^^^^^^^^

�[0m

�[33mwarning[2072]: �[0m�[33mWarning: Unused local variable.
   --> tests/StaticATokenLM.t.sol:237:5:
    |
237 |     uint256 claimable = staticATokenLM.getClaimableRewards(user, REWARD_TOKEN());
    |     ^^^^^^^^^^^^^^^^^

�[0m

�[33mwarning[2018]: �[0m�[33mWarning: Function state mutability can be restricted to view
  --> tests/StaticATokenLM.t.sol:26:3:
   |
26 |   function REWARD_TOKEN() public returns (address) {
   |   ^ (Relevant source part starts here and spans across multiple lines).

�[0m

�[33mwarning[2018]: �[0m�[33mWarning: Function state mutability can be restricted to view
  --> tests/StaticATokenMetaTransactions.sol:25:3:
   |
25 |   function REWARD_TOKEN() public returns (address) {
   |   ^ (Relevant source part starts here and spans across multiple lines).

�[0m

�[33mwarning[2018]: �[0m�[33mWarning: Function state mutability can be restricted to view
  --> tests/StaticATokenNoLM.t.sol:23:3:
   |
23 |   function REWARD_TOKEN() public returns (address) {
   |   ^ (Relevant source part starts here and spans across multiple lines).

�[0m

| Contract                    | Size (kB) | Margin (kB) |
|-----------------------------|-----------|-------------|
| AToken                      | 10.309    | 14.267      |
| AaveGovernanceV2            | 0.272     | 24.304      |
| AaveMisc                    | 0.086     | 24.49       |
| AaveV3Arbitrum              | 0.086     | 24.49       |
| AaveV3ArbitrumAssets        | 0.086     | 24.49       |
| AaveV3Avalanche             | 0.086     | 24.49       |
| AaveV3AvalancheAssets       | 0.086     | 24.49       |
| AaveV3Ethereum              | 0.086     | 24.49       |
| AaveV3EthereumAssets        | 0.086     | 24.49       |
| AaveV3Optimism              | 0.086     | 24.49       |
| AaveV3OptimismAssets        | 0.086     | 24.49       |
| AaveV3Polygon               | 0.086     | 24.49       |
| AaveV3PolygonAssets         | 0.086     | 24.49       |
| Address                     | 0.086     | 24.49       |
| ConfiguratorInputTypes      | 0.086     | 24.49       |
| DataTypes                   | 0.086     | 24.49       |
| DeployATokenFactory         | 0.086     | 24.49       |
| ERC1967Proxy                | 0.708     | 23.868      |
| Errors                      | 4.399     | 20.177      |
| GPv2SafeERC20               | 0.086     | 24.49       |
| MathUtils                   | 0.086     | 24.49       |
| ProxyAdmin                  | 1.69      | 22.886      |
| RayMathExplicitRounding     | 0.086     | 24.49       |
| RefreshRobotKeeper          | 3.292     | 21.284      |
| ReserveConfiguration        | 0.171     | 24.405      |
| RewardsDataTypes            | 0.086     | 24.49       |
| SafeCast                    | 0.086     | 24.49       |
| SafeERC20                   | 0.086     | 24.49       |
| SigUtils                    | 1.706     | 22.87       |
| StaticATokenErrors          | 0.611     | 23.965      |
| StaticATokenFactory         | 3.689     | 20.887      |
| StaticATokenLM              | 17.275    | 7.301       |
| StdInvariant                | 2.048     | 22.528      |
| StorageSlot                 | 0.086     | 24.49       |
| TransparentProxyFactory     | 7.595     | 16.981      |
| TransparentUpgradeableProxy | 2.161     | 22.415      |
| WadRayMath                  | 0.086     | 24.49       |
| console                     | 0.086     | 24.49       |
| console2                    | 0.086     | 24.49       |
| stdError                    | 0.598     | 23.978      |
| stdJson                     | 0.086     | 24.49       |
| stdMath                     | 0.086     | 24.49       |
| stdStorage                  | 0.086     | 24.49       |
| stdStorageSafe              | 0.086     | 24.49       |
Test success 🌈
No files changed, compilation skipped

Running 2 tests for tests/RefreshRobotKeeper.t.sol:RefreshRobotKeeperTest
�[32m[PASS]�[0m testAdmin() (gas: 21414)
�[32m[PASS]�[0m testRefreshRewards() (gas: 1309416)
Test result: �[32mok�[0m. 2 passed; 0 failed; finished in 150.93ms

Running 5 tests for tests/StaticATokenMetaTransactions.sol:StaticATokenMetaTransactions
�[32m[PASS]�[0m testAdmin() (gas: 21458)
�[32m[PASS]�[0m test_metaDepositAToken() (gas: 527804)
�[32m[PASS]�[0m test_metaDepositATokenUnderlying() (gas: 464103)
�[32m[PASS]�[0m test_metaDepositATokenUnderlyingNoPermit() (gas: 437241)
�[32m[PASS]�[0m test_metaWithdraw() (gas: 561424)
Test result: �[32mok�[0m. 5 passed; 0 failed; finished in 164.63ms

Running 29 tests for tests/StaticATokenLM.t.sol:StaticATokenLMTest
�[32m[PASS]�[0m testAdmin() (gas: 21480)
�[32m[PASS]�[0m testFail_claimRewardsOnBehalfOf() (gas: 706588)
�[32m[PASS]�[0m testFail_mintAboveBalance() (gas: 491657)
�[32m[PASS]�[0m testFail_redeemAboveBalance() (gas: 682378)
�[32m[PASS]�[0m testFail_redeemOverflowAllowance() (gas: 716374)
�[32m[PASS]�[0m testFail_withdrawAboveBalance() (gas: 908526)
�[32m[PASS]�[0m test_claimRewards() (gas: 642147)
�[32m[PASS]�[0m test_claimRewardsToSelf() (gas: 640788)
�[32m[PASS]�[0m test_collectAndUpdateRewards() (gas: 604329)
�[32m[PASS]�[0m test_convertersAndPreviews() (gas: 51146)
�[32m[PASS]�[0m test_depositATokenClaimWithdrawClaim() (gas: 786699)
�[32m[PASS]�[0m test_depositWETHClaimWithdrawClaim() (gas: 786715)
�[32m[PASS]�[0m test_getUnclaimedRewards() (gas: 610986)
�[32m[PASS]�[0m test_getters() (gas: 52202)
�[32m[PASS]�[0m test_maxDepositUnderlying_20kCap() (gas: 101237)
�[32m[PASS]�[0m test_maxDepositUnderlying_50kCap() (gas: 123844)
�[32m[PASS]�[0m test_maxDepositUnderlying_freeze() (gas: 89161)
�[32m[PASS]�[0m test_maxDepositUnderlying_noCap() (gas: 89867)
�[32m[PASS]�[0m test_maxDepositUnderlying_paused() (gas: 85984)
�[32m[PASS]�[0m test_maxRedeemUnderlying_allAvailable() (gas: 550896)
�[32m[PASS]�[0m test_maxRedeemUnderlying_nonAvailable() (gas: 1007547)
�[32m[PASS]�[0m test_maxRedeemUnderlying_partAvailable() (gas: 1025544)
�[32m[PASS]�[0m test_maxRedeemUnderlying_paused() (gas: 572620)
�[32m[PASS]�[0m test_mint() (gas: 560695)
�[32m[PASS]�[0m test_redeem() (gas: 607500)
�[32m[PASS]�[0m test_redeemAllowance() (gas: 668718)
�[32m[PASS]�[0m test_redeemUnderlying() (gas: 619475)
�[32m[PASS]�[0m test_transfer() (gas: 901362)
�[32m[PASS]�[0m test_withdraw() (gas: 611304)
Test result: �[32mok�[0m. 29 passed; 0 failed; finished in 137.39ms

Running 3 tests for tests/StaticATokenNoLM.t.sol:StaticATokenNoLMTest
�[32m[PASS]�[0m testAdmin() (gas: 21414)
�[32m[PASS]�[0m test_claimRewardsToSelfWithLMDisabled() (gas: 490400)
�[32m[PASS]�[0m test_collectAndUpdateRewardsWithLMDisabled() (gas: 491800)
Test result: �[32mok�[0m. 3 passed; 0 failed; finished in 365.04ms

@brotherlymite brotherlymite changed the title [WIP] feat: refresh rewards automation feat: refresh rewards automation Apr 5, 2023
@brotherlymite brotherlymite marked this pull request as ready for review April 5, 2023 06:59
@brotherlymite brotherlymite requested a review from sakulstra April 6, 2023 04:08
Comment thread src/robots/RefreshRewardsRobot.sol
Comment thread src/robots/RefreshRewardsRobot.sol
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants